
App({
  onLaunch() {
  },
  globalData: {
    url:"http://localhost:8089/",
    userInfoList:{},
    stocklist:{},
    gameImage:[{
      id:0,
      name:"碧蓝航线",
      // src:"/pages/pic-game/碧蓝航线"
      src:"../pic-game/碧蓝航线/"
      },{
      id:1,
      name:"碧蓝航线",
      // src:"/pages/pic-game/碧蓝航线"
      src:"../pic-game/碧蓝航线/"
      },
      {
      id:2,
      name:"和平精英",
      // src:'/pages/pic-game/和平精英'
      src:"../pic-game/和平精英/"
      },
      {
      id:3,
      name:"坎特伯雷公主与骑士唤醒冠军之剑的奇幻冒险",
      // src:'/pages/pic-game/坎特伯雷公主与骑士唤醒冠军之剑的奇幻冒险'
      src:"../pic-game/坎特伯雷公主与骑士唤醒冠军之剑的奇幻冒险/"
      },
      {
      id:4,
      name:"明日方舟",
      // src:'/pages/pic-game/明日方舟'
      src:"../pic-game/明日方舟/"
      },
      {
      id:5,
      name:"少女前线",
      // src:'/pages/pic-game/少女前线'
      src:"../pic-game/少女前线/"
      },
      {
      id:6,
      name:"王牌战士",
      // src:'/pages/pic-game/王牌战士'
      src:"../pic-game/王牌战士/"
      },
      {
      id:7,
      name:"王牌战争",
      // src:'/pages/pic-game/王牌战争'
      src:"../pic-game/王牌战争/"
      },
      {
      id:8,
      name:"王者荣耀",
      // src:'/pages/pic-game/王者荣耀'
      src:"../pic-game/王者荣耀/"
      },
      {
      id:9,
      name:"原神",
      // src:'/pages/pic-game/原神'
      src:"../pic-game/原神/"
      },
      {
      id:10,
      name:"战双帕弥什",
      // src:'/pages/pic-game/战双帕弥什'
      src:"../pic-game/战双帕弥什/"
      },
      {
      id:11,
      name:"重装上阵",
      // src:'/pages/pic-game/重装上阵'
      src:"../pic-game/重装上阵/"
      },
      {
      id:12,
      name:"FateGrand Order",
      // src:'/pages/pic-game/FateGrand Order'
      src:"../pic-game/FateGrand Order/"
      },
    ],
  },
  getUserInfo: function (cb) {
    var that = this
    if (this.globalData.userInfo) {
      typeof cb == "function" && cb(this.globalData.userInfo);
    } else {
      //调用登录接口
      wx.login({
        success: function (res) { // 获取用户openid
          let code = res.code;
          wx.getUserInfo({
            success: function (res) {
              let r_data = {};
              r_data.code = code;
              r_data.encryptedData = res.encryptedData;
              r_data.iv = res.iv;
              // wx.request({
              //   url: 'https://xxx',
              //   header: { "content-type": "application/x-www-form-urlencoded" },
              //   method: 'post',
              //   data: r_data,
              //   success: function (res) {
              //     console.log(res)
              //   },
              //   fail: function (res) {
              //     wx.showModal({
              //       title: '提示',
              //       content: 'error:网络请求失败',
              //       showCancel: false
              //     })
              //     return false;
              //   }
              // });
              that.globalData.userInfo = res.userInfo;
              typeof cb == "function" && cb(that.globalData.userInfo);
            }
          });
        }
      });
    }
  }
})
